package wsz.resume.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wsz.resume.service.ResumeService;

/**
 * @author wsz
 * @date 2021/12/17 16:31
 **/
@RestController
@RequestMapping(value = "resume")
public class ResumeController {

    @Value("${server.port}")
    private Integer port;

    @Autowired
    private ResumeService resumeService;

    @GetMapping("openstate/{userId}")
    public Integer findDefaultResumeState(@PathVariable Long userId) {
        return resumeService.findDefauleResumeByUserId(userId).getIsDefault();
    }

    @GetMapping("getPort")
    public Integer getPort() {
        return port;
    }


    @GetMapping("getPortTimeout")
    public Integer getPortTimeout() {
        try {
            Thread.sleep(3000);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return port;
    }

}
